package pme;

public class Divide extends Value{
	private double currNum;
 	
   /**
    * divides a value by another
    * 
    * @param initVal1 value to be divided
    * @param initVal2 divisor
    */
     	
	public Divide(Value initVal1, Value initVal2){
        if (initVal1==null) initVal1= new NullValue();
		if (initVal2==null) initVal2= new NullValue();
		

		currNum = (initVal2==null || initVal2.evaluate() == 0)?  
    		          0.0 :
                      initVal1.evaluate()/initVal2.evaluate();
	}
		
	public double evaluate(){
		return currNum;
	}
}
